<?php  
	session_start();
    require('../Model/mysql.php');
    require('../host_config.php');
    if (!isset($_SESSION['shopid']) && isset($_SESSION['flag'])) {
    	echo "<script language='javascript'>";
        echo "alert('You have no permission to read this page!');";
        echo "history.back();";
        echo "</script>";
        header("location:../login.php");
    }else if($_SESSION['flag'] == "2") {
    	
    }else if($_SESSION['shopid'] != $_GET['id']) {
    	header("location:select.php?id=".$_SESSION['shopid']);
    }
        $shopid = $_GET["id"];
        $mysql = new MySQL();
        $link = $mysql->connect($mysql_host, $mysql_user, $mysql_passwd, $mysql_db);
        header("refresh:10");
    
?>
<!DOCTYPE html>
<html>

<head>
<meta name="viewport" content="width=device-width; text/html; charset=utf-8" http-equiv="Content-Type">
<title>訂位資訊</title>
<link href="../mobile.css" rel="stylesheet" type="text/css">
</head>

<body>

<div id="banner">
	訂位資訊
	<div id="home">
		<a href="select.php">
		<img alt="" class="auto-style1" height="40" src="../pic/home.png" width="40"></a>
	</div>
	<div id="logout">
		<a href="../logout.php">
		<img alt="" class="auto-style1" height="41" src="../pic/logout.png" width="41"></a>
	</div>
</div>

<div id="content">
	<br/>
    <H1 align="center">取消訂位名單</H1>
    <table border='1' align='center'><tr align='center'>
		<td>項次</td>
        <td>客戶名稱</td>
        <td>訂位人數</td>
        <td>電話號碼</td>
        <td>訂位時間</td>
        <td>到達時間</td>
        <td>離開時間</td>
        <td>桌子種類</td>
    	</tr>
    	<?php
        	$sql = "SELECT `clientname`, `orderofnum`, `cellphone`, `ordertime`, `arrivetime`, `leavetime`, `tabletype` FROM `Statistics` WHERE `shopid` = '$shopid'";
            $result = $mysql->query($sql, $link);
            
            $count = 0;
            while ($row = mysql_fetch_row($result)) {
				echo "<td>".$count."</td>";
            	for ($i = 0; $i < mysql_num_fields($result); $i++) {
                	echo "<td>".$row[$i]."</td>";
				}
                echo "</tr>";
                ++$count;
            }       
        ?>
   	</table>
	<p align="center"><a href="client.php?id=<?php echo $shopid;?>">訂位名單</a>
	<p align="center">回到<a href="test.php?id=<?php echo $shopid;?>">訂位人數</a></p>
	<br />
</div>
</body>

</html>
